change returning datetime timezone to recalculate with user timezone laravel

113

laravel date set timezone -

edit /config/app.php
'timezone' => 'Asia/Dhaka'

change returning datetime timezone to recalculate with user timezone laravel -

// on a date column
$user->created_at->timezone('Asia/Kolkata')->toDateTimeString()

// Directly on a Carbon instance 
Carbon\Carbon::parse('2018-01-22 04:09:31')->timezone('Asia/Kolkata')->toDateTimeString()


Check out these Links
Credit: https://laracasts.com/discuss/channels/laravel/change-date-timezone-in-laravel-project-while-fetching-date?page=1&replyId=576247
Actual Article: https://qcode.in/managing-users-timezone-in-laravel-app/

Comments

Submit
0 Comments